# Maintainer: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Richard Murri <admin@richardmurri.com>
# Contributor: Michal Krenek <mikos@sg1.cz>

pkgname=ecryptfs-utils
pkgver=111
pkgrel=7
arch=('loong64' 'x86_64')
pkgdesc="Enterprise-class stacked cryptographic filesystem for Linux"
url="https://launchpad.net/ecryptfs"
license=('GPL')
makedepends=('intltool' 'gettext')
depends=('nss' 'pam')
source=("https://launchpad.net/ecryptfs/trunk/${pkgver}/+download/${pkgname}_${pkgver}.orig.tar.gz"
        "${pkgname}_${pkgver}.orig.tar.gz.sig::https://launchpad.net/ecryptfs/trunk/${pkgver}/+download/..-${pkgname}_${pkgver}.orig.tar.gz.asc"
        "openssl-1.1.x.patch")
md5sums=('83513228984f671930752c3518cac6fd'
         'SKIP'
         'bc69f5adcd397220bb8575252486c69f')
sha256sums=('112cb3e37e81a1ecd8e39516725dec0ce55c5f3df6284e0f4cc0f118750a987f'
            'SKIP'
            '73d3689e51e57a03f8de66bfdb4a4c4fcc7f1c233895a7a576df6da7f64366d6')
validpgpkeys=('E2D9E1C5F9F5D59291F4607D95E64373F1529469')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np0 -i "${srcdir}"/openssl-1.1.x.patch
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --with-pamdir=/usr/lib/security \
              --disable-pywrap
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}"/ rootsbindir='/usr/bin' install
  chmod +s "${pkgdir}"/usr/bin/mount.ecryptfs_private
}
